<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=2.0, user-scalable=no"/>
<title>浙江日报报卡激活</title>
<link href="/Public/css/zjcard/zjdailycard.css" type="text/css" rel="stylesheet" />
<link href="/Public/css/zjcard/common.css" type="text/css" rel="stylesheet" />
<!-- <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css"> -->
<link href="/Public/css/bootstrap/bootstrap.min.css" rel="stylesheet">

<!-- 可选的Bootstrap主题文件（一般不用引入） -->

<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<!--<script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script> -->
<script src="/Public/js/user/jquery.min.js"></script>

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<!--<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> -->
<script src="/Public/js/user/bootstrap.min.js"></script>
</head>
<body style="background-color:#f7f7f9">
    <div class="banner" style="display:none">
        <img src="/Public/images/zjcard/banner.jpg" width="100%">
    </div>
    <div class="bannerTop">
    </div>
    <div id="wrapper">
    	<div class="boxR">
        	<a href="javascript:void(0);" class="alogo">浙报传媒</a>
            <div class="zbFont">浙江日报</div>
            <div class="zbFt">2016年全年订报卡<span>订价：360元</span></div>
            <div class="ecode"></div>
        </div> 
        <form class="boxL" name="activeCard">
            <ul class="ulInput">
                <li>
                    <span class=" icon iconfont icon-lianxiren01 spanLogo fontsPic"></span>
                    <input placeholder="姓名" type="text" class="inputTxt placeFix" name="username">
                </li>
                <li>
                    <span class=" icon iconfont icon-gezicopt spanLogo fontsPic"></span>
                    <input placeholder="卡号" type="text" class="inputTxt placeFix" name="cardnumber">
                </li>
                <li>
                    <span class=" icon iconfont icon-key spanLogo fontsPic"></span>
                    <input placeholder="密码" type="password" class="inputTxt placeFix" name="password">
                </li>
                <li>
                    <span class=" icon iconfont icon-dianhua spanLogo fontsPic"></span>
                    <input placeholder="联系方式" type="text" class="inputTxt" name="telephone">
                </li>
                <li>
                    <span class="icon iconfont icon-icon3 spanLogo fontsPic"></span>
                    <input placeholder="通讯地址" type="hidden" class="inputTxt" name="addr_id">
                    <input placeholder="通讯地址" type="text" class="inputTxt" name="address" disabled>
                    <button type="button" formmethod="POST" formaction="{:U('Wap/CustomerAddr/index')}" id="redirectToAddr">选择地址</button>
                </li>
            </ul>
            <button type="submit" class="activateBtn">我要激活</button>
            <p style="font-size:13px;color:red;width:100px;margin:7px auto;" class="info"></p>
        </form>
    </div>

    <div class="modal fade" id="loginModal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">用户登录</h4>
                </div>
                <div class="modal-body">
                    <form name="customerLogin" id="customerLogin">
                        <input class="form-control" name="telephone" type="tel" data-require="telephone"/>
                        <input class="form-control margin-vertical-top" name="password" type="password" data-require="password"/>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default toggleModal" data-target="2">没有账号？注册</button>
                    <button type="submit" form="customerLogin" class="btn btn-primary">登录</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->

    <div class="modal fade" id="registeModal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">用户注册</h4>
                </div>
                <div class="modal-body">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default toggleModal" data-target="1">已有账号登录？登录</button>
                    <button type="button" class="btn btn-primary">注册</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
</body>

<script type="text/javascript" src="/Public/js/zjdailyCard/page.zjdailyCard.js"></script>
<script type="text/javascript">
page.zjdailyCard.cookie.restore( "form[name='activeCard']" );
( function(){
  var val = $("input[name='addr_id']").val();
  if( !parseInt( val ) ){
    return;
  }
  $.ajax({
    url: "{:U('Wap/CustomerAddr/getAddr')}",
    type: "POST",
    data: { addr_id: parseInt( val ) },
    success: function( result ){
        if( result.err === 200 ){
            $( "input[name='address']" ).attr( "placeholder", result.address );
        }else{
            $( "input[name='address']" ).attr( "placeholder", "" );
        }
    },
    error: function(){
        $( "input[name='address']" ).attr("placeholder");
    }
  });
} )();
page.zjdailyCard.index.init( 
        "form[name='activeCard']", 
        "{:U('Wap/ZJDailyCard/active')}", 
        "POST"
);

page.zjdailyCard.loginRegiste.init( {
        modalLogin: "#loginModal",
        modalRegiste: "#registeModal",
        toggleModal: ".toggleModal",
        formLogin: "form[name='customerLogin']",
        formRegiste: "form[name='customerRegiste']",
        httpResLogin: "{:U('Wap/Customer/Login')}",
        httpResRegiste: "{:U('Wap/Customer/Registe')}"
} );

$( "form[name='activeCard']" ).unbind( "submit" ).bind( "submit", function( event ){
    event.preventDefault();
    page.zjdailyCard.online.check( 
        "{:U('Wap/Customer/check')}", 
        page.zjdailyCard.index.enable, 
        page.zjdailyCard.loginRegiste.enableLogin
    );
} );

$( "#redirectToAddr" ).unbind( "click" ).bind( "click", function(){
        var curren = $( this );
        page.zjdailyCard.online.check( 
            "{:U('Wap/Customer/check')}",
            function(){
                page.zjdailyCard.cookie.store( "form[name='activeCard']" );
                window.location.href = curren.attr( "formaction" );
            },
            function(){
                page.zjdailyCard.loginRegiste.enableLogin( 
                    function(){
                        page.zjdailyCard.cookie.store( "form[name='activeCard']" );
                        window.location.href = curren.attr( "formaction" );
                    });
            }
        );
} );

</script>
</html>
